{% extends 'base.html' %}
{% load brispon_filter %}
{% load thumbnail %}

{% block title %}Brisbane Coupon{% endblock %}
{% block stylesheet %}
{{ block.super }}
<style type="text/css">
img {
    width  : 100%;
    height : auto;
}
table.bottomBorder { border-collapse:collapse; }
table.bottomBorder td, table.bottomBorder th { border-bottom:1px dotted black;padding:7px; }
</style>
{% endblock%}

{% block javascript %}
{{ block.super }}
<script type="text/javascript" src="{{ STATIC_PREFIX }}js/m/kakaoLink.js"></script>
<script type="text/javascript">
function(){
	jQuery('#kakao').live('click', function(){
		//alert('asdfs');
		var msg = "{{ full_path }}";
	    var url = "http://brisbanecoupon.com";
	    var appid = "m.kakao.com";
	    var appver = "2.0";
	    var appname = "Brisbane Coupon";
	    var link = new com.kakao.talk.KakaoLink(appid, appver, url, msg, appname);
	    link.execute();
	}
});
</script>
{% endblock%}

{% block content %}
{% load thumbnail %}

<h3><a href="{{ store.murl }}">{{ store.name }}</a> | {{ store.category.name }}</h3>
<hr>
<p>
{{ store.representative|safe }}
</p>

<hr>

<h3>Basic Information</h3>
<table class="bottomBorder">
{% if store.addr %}
<tr>
<td><strong>Address</strong></td>
</tr>
<tr>
<td>{{ store.detail_addr }}<a href="http://maps.google.com/?q={{ store.addr }}">{{ store.addr }}</a></td>
</tr>
{% endif %}
{% if store.tel1 %}
<tr>
<td><strong>Phone</strong></td>
</tr>
<tr>
<td>{{ store.tel1|htel|safe }}</td>
</tr>
{% endif %}
{% if store.tel2 %}
<tr>
<td><strong>Phone</strong></td>
</tr>
<tr>
<td>{{ store.tel2|htel|safe }}</td>
</tr>
{% endif %}
{% if store.internet_tel %}
<tr>
<td><strong>Internet Phone</strong></td>
</tr>
<tr>
<td>{{ store.internet_tel|safe }}</td>
</tr>
{% endif %}
{% if store.mobile1 %}
<tr>
<td><strong>Mobile Phone</strong></td>
</tr>
<tr>
<td>{{ store.mobile1|htel|safe }}</td>
</tr>
{% endif %}
{% if store.mobile2 %}
<tr>
<td><strong>Mobile Phone</strong></td>
</tr>
<tr>
<td>{{ store.mobile2|htel|safe }}</td>
</tr>
{% endif %}
{% if store.fax %}
<tr>
<td><strong>Fax</strong></td>
</tr>
<tr>
<td>{{ store.fax|safe }}</td>
</tr>
{% endif %}
{% if store.email %}
<tr>
<td><strong>Email</strong></td>
</tr>
<tr>
<td>{{ store.email }}</td>
</tr>
{% endif %}
{% if store.website %}
<tr>
<td><strong>Website</strong></td>
</tr>
<tr>
<td>{{ store.website }}</td>
</tr>
{% endif %}
{% if store.trading_hours %}
<tr>
<td><strong>Trading Hours</strong></td>
</tr>
<tr>
<td><p>{{ store.trading_hours|safe }}</p></td>
</tr>
{% endif %}
</table>

<h3>Description</h3>
{{ store.description|safe }}


<h3>Gallery</h3>
{% if store.image1 %}
{% thumbnail store.image1 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}

{% if store.image2 %}
{% thumbnail store.image2 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}

{% if store.image3 %}
{% thumbnail store.image3 "300x200" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}
{% endif %}

  
<ul data-role="listview" data-inset="true">
  <li data-role="list-divider">Events <span class="ui-li-count">{{ store.event_set.all.count }}</span></li>
    {% for e in store.event_set.all %}
    <li><a href="{{ e.murl }}">
    <h3>{{ e.name }}</h3>
    <p>{{ e.representative|safe }}</p>
    <p class="ui-li-aside"><strong>By {{ e.edate|date:"D d M" }}</strong></p>
    </a></li>
    {% endfor %}
</ul>

<div data-role="collapsible" data-content-theme="c">
  <h3>Similar Stores</h3>
  <p>
    <ul>
      {% for s in store.get_similar_stores %}
      <li><a href="{{ s.murl }}">{{ s.name }}</a></li>
      {% empty %}
      <li>유사한 Store가 없습니다.</li>
      {% endfor %}
    </ul>
  </p>
</div>

<div data-role="collapsible" data-content-theme="c">
  <h3>Near Stores</h3>
  <p>
    <ul>
      {% for s in store.get_near_stores %}
      <li><a href="{{ s.murl }}">{{ s.name }}</a></li>
      {% empty %}
      <li>가까운 거리에 Store가 없습니다.</li>
      {% endfor %}
    </ul>
  </p>
</div>

<script type="text/javascript">
$('#mobile-content').live('pageinit', function(event){
    $('#kakao').live('click', function(){
        var msg = "{{ full_path }}";
        var url = "http://brisbanecoupon.com";
        var appid = "m.kakao.com";
        var appver = "2.0";
        var appname = "Brisbane Coupon";
        var link = new com.kakao.talk.KakaoLink(appid, appver, url, msg, appname);
        link.execute();
    });
});
</script>
{% endblock %}
